const express = require('express')
const {
    emp
} = require('./mongoose')
var bodyParser = require('body-parser')

const app = express()

app.use(express.json())
app.use(bodyParser.urlencoded({
    extended: false
}))

app.get('/login', (req, res) => {
    res.send('444444444')
})

app.post('/login', async (req, res) => {
    let empConllection = await emp.find()
    let epmList = empConllection[0].data
    let resEmp = epmList.forEach(element => {
        element.email === req.body.email
    });
    res.send(resEmp)
})

app.listen(3000, () => {
    console.log('the serve running in 3000');
})